/*
 * @Author: Bennty
 * @Date: 2024-05-17 20:04:45
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-05-17 20:51:05
 * @Description: 请填写简介
 */
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderVO, OrderForm, OrderQuery } from '@/api/sj/order/types';


/**
 * 查询蛋糕类型列表
 * @param query
 * @returns {*}
 */

export const listCake = (query?: OrderQuery): AxiosPromise<OrderVO[]> => {
  return request({
    url: '/sj/cake/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单类别
 * @param query
 * @returns {*}
 */

export const listCakeMaterial = (query: {type:string})=> {
  return request({
    url: '/system/typeJoinPrice/getByType',
    method: 'get',
    params: query
  });
};
/**
 * 查询体量区间
 * @param query
 * @returns {*}
 */
export const massOrder = (query: {type:string})=> {
  return request({
    url: '/system/typeJoinPrice/list',
    method: 'get',
    params: query
  });
};
export const massCount = (dictType: string): AxiosPromise<OrderVO[]>=> {
  return request({
    url: '/system/dict/data/type/'+ dictType,
    method: 'get',
  });
};
// 根据字典类型查询字典数据信息
export function getDicts(dictType: string): AxiosPromise<OrderVO[]> {
  return request({
    url: '/system/dict/data/type/' + dictType,
    method: 'get'
  });
}

export const getTotalPrices = (data:any) => {
  return request({
    url: '/sj/cakeMaterial/getMoney',
    method: 'POST',
    data
  });
}
// /**
//  * 查询
//  * @param id
//  */
// export const orderList = () => {
//   return request({
//     url: '/sj/consume/getCakeById/1731127762279522305',
//     method: 'get'
//   });
// };

/**
 * 查询
 * @param id
 */
export const orderList = (id:string) => {
  return request({
      url: `/sj/consume/getCakeById/${id}`,
      method: 'get'
    });
  };

  /** 
   * 根据id与默认配置类型选取默认配置数据
   */

  export const getDefaultConfigById = (params:any)=>{
    return request({
      url: '/sj/cakeMaterial/getDefaultSetting',
      method: 'get',
      params
    });
  };
  



// /**
//  * 查询蛋糕基础材质列表
//  * @param query
//  * @returns {*}
//  */

// export const listCakeMaterial = (query?: OrderQuery): AxiosPromise<OrderVO[]> => {
//   return request({
//     url: '/sj/cakeMaterial/list',
//     method: 'get',
//     params: query
//   });
// };

// /**
//  * 查询蛋糕基础材质详细
//  * @param id
//  */
// export const getCakeMaterial = (id: string | number): AxiosPromise<OrderVO> => {
//   return request({
//     url: '/sj/cakeMaterial/' + id,
//     method: 'get'
//   });
// };

// /**
//  * 新增蛋糕基础材质
//  * @param data
//  */
// export const addCakeMaterial = (data: OrderForm) => {
//   return request({
//     url: '/sj/cakeMaterial',
//     method: 'post',
//     data: data
//   });
// };

// /**
//  * 修改蛋糕基础材质
//  * @param data
//  */
// export const updateCakeMaterial = (data: OrderForm) => {
//   return request({
//     url: '/sj/cakeMaterial',
//     method: 'put',
//     data: data
//   });
// };

// /**
//  * 删除蛋糕基础材质
//  * @param id
//  */
// export const delCakeMaterial = (id: string | number | Array<string | number>) => {
//   return request({
//     url: '/sj/cakeMaterial/' + id,
//     method: 'delete'
//   });
// };
